package com.hzz.mybatisplusdemo.config;

import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;

/**
 * @author ：hzz
 * @description：TODO
 * @date ：2021/11/24 11:03
 */
public class IDhelper
{
    //用mybatis-plus生成Long ID
    public  static Long getNextId()
    {
        IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
        Number id=  identifierGenerator.nextId(new Object());
        Long nextid = Long.parseLong(id+"");
        return nextid;
    }

    public static void main(String[] args) {
        System.out.println(getNextId());
    }

}